<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">

   <meta charset="UTF-8">
		<title>所有考勤信息</title>
		<link rel="stylesheet" href="./layui/css/layui.css" />
		<script type="text/javascript" src="./layui/layui.js" ></script>
	</head>
	<body>
		<div class="layui-container">
			
			<div class="layui-row">
				<fieldset class="layui-elem-field layui-field-title">
					<legend>所有考勤信息</legend>
				</fieldset>
				<div class="searchTable">
	  				<div class="layui-inline">
	    				<input class="layui-input" name="id" id="dataReload" autocomplete="off" placeholder="请输入学生姓名">
	  				</div>
	  				<button class="layui-btn" data-type="reload">搜索</button>
				</div>
				<table class="layui-table" id="allAtt" lay-filter="allAtt"></table>
			</div>
		</div>
		<script type="text/javascript">
			layui.use(['table','layer','jquery'],function(){
				var table = layui.table,
				layer = layui.layer,
				$ = layui.jquery;
				table.render({
					elem:"#allAtt",
					 height: 500,
					url:'selectAllAttForBuildNameServlet',
					page:true,
					toolbar: true ,
					id:'allAttTable',
					cols: [[
					
				      	{field:'name', title:'姓名', width:100, fixed: 'left'}
				      	,{field:'College', title:'学院', width:60}
				      	,{field:'major', title:'专业', width:60,}
				      	,{field:'tClass', title:'班级', width:80}
				      	,{field:'dNub', title:'宿舍', width:60,sort: true}
				      	,{field:'Is_leave', title:'请假', width:60}
				      	,{field:'Time_for_leave', title:'请假时间', width:120}
				      	,{field:'Stay_out_late', title:'晚归', width:60,edit: 'text'}
				      	,{field:'Late_return_time',title:'回寝时间',width:120}
				      	,{field:'No_return', title:'未归',  width:60}
				      	,{field:'Att_date', title:'考勤日期',  width:100,sort: true}
				      	,{field:'Remarks', title:'备注',  width:100, edit: 'text'}
					    ]] 
					    ,response: {
				      		statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0  
				    	}
					    ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
					      return {
					        "code": res.status, //解析接口状态
					        "msg": res.message, //解析提示文本
					        "count": res.datasize, //解析数据长度
					        "data": res.rows.item //解析数据列表
					      };
					    }
				});
				var  active = {
					reload:function(){
						var dataReload = $('#dataReload');
					//	if(dataReload.val()){
							var index = layer.msg('查询中，请稍候...',{icon: 16,time:false,shade:0});
							setTimeout(function(){
						
								//执行重载
								table.reload('allAttTable',{
								page: {
									curr:1 //重新从第一页开始
								}
								,where: {

										sName:dataReload.val()
							}
						});
								layer.close(index);
							},800);

					}
				};
			
				$('.searchTable .layui-btn').on('click',function(){
					var type = $(this).data('type');
		
    				active[type] ? active[type].call(this) : ' ';
				});
			});
		</script>
	</body>
</html>
